#ifndef __PTHREAD_BASE_MAIN_H__
#define __PTHREAD_BASE_MAIN_H__

#include "pthreadWork.h"
#include "typeDef.h"

#define  MAX_RECV_BUFF_LEN      (1024*1024)
#define  MAX_SEND_BUFF_LEN      (1024*1024)

class   CBaseMainManager;

class SERAPI CBaseMainPthread : public  CWorkPthread
{
    CBaseMainManager        *m_pBaseMain;
    GUINT32                  m_maxRecvBufLen;
    GUINT32                  m_maxSendBufLen;
    GINT8*                   m_pRecvBuf;
    GINT8*                   m_pSendBuf;
    GUINT32                  m_oldTime;
    TBOOL                     m_firstRun;
    TBOOL                     m_bMainThread;
public:
    CBaseMainPthread();
    ~CBaseMainPthread();
    
public:
    virtual VOID Go(VOID);
    
    STATUS Init(CRecvRoundSeq* recvSeq,
              CSendRoundSeq* sendSeq,
              CBaseMainManager* pBaseMain,
              GUINT32 recvMaxBufLen,
              GUINT32 sendMaxbufLen,
              GUINT32 pthreadId,
              TBOOL bMainThread = false);

    STATUS Close();   

    STATUS SendData(GINT32 sock, GINT8* pBuf, GUINT32 len);

    GINT8* GetSendBuf(GUINT32 *pMaxSendBufLen);
    
    GUINT32 GetPtheadId(void);
};

#endif
